<!-- BEGIN:main -->
<script type="text/javascript">
    function dathang()
    {
        var hoten = $('#hoten').val();
        var mssv = $('#mssv').val();
        var lop = $('#lop').val();
        var diachi = $('#diachi').val();
        var sdt = $('#sdt').val();
        var email = $('#email').val();
        var loaihs = $('#loaihoso').val();
        var soluong = $('#soluong').val();
        var ngaynhan = $('#date_to').val();
        var ghichu = $('#ghichu').val();
        var ngaysinh = $('#date_from').val();
        var tencty = $('#tencty').val();
        var diachicty = $('#diachicty').val();
        var sdtcty = $('#sdtcty').val();
        var dataString = "action=add" +
                "&hoten=" + hoten +
                "&mssv=" + mssv +
                "&lop=" + lop +
                "&ngaysinh=" + ngaysinh +
                "&diachi=" + diachi +
                "&sdt=" + sdt +
                "&email=" + email +
                "&loaihs=" + loaihs +
                "&soluong=" + soluong +
                "&ngaynhan=" + ngaynhan +
                "&ghichu=" + ghichu +
                "&tencty=" + tencty +
                "&diachicty=" + diachicty +
                "&sdtcty=" + sdtcty;        
                var location = "index.php?com=com_dathang&view=view";
        $.ajax({
            type: "POST",
            url: location,
            data: dataString,
            cache: false,
            beforeSend: function()
            {
                $("#btnsave").html("Đang lưu");
            },
            success: function(response) {

                $("#btnsave").hide().fadeIn('fast').html('Lưu Thông Tin');
                //loadpage(index);
                window.history.go(-1);
                //self.location = location_succ;
            }
        });
    }
    function capnhat()
    {
        var hoten = $('#hoten').val();
        var mssv = $('#mssv').val();
        var lop = $('#lop').val();
        var diachi = $('#diachi').val();
        var sdt = $('#sdt').val();
        var email = $('#email').val();
        var loaihs = $('#loaihoso').val();
        var soluong = $('#soluong').val();
        var ngaynhan = $('#date_to').val();
        var ghichu = $('#ghichu').val();
        var ngaysinh = $('#date_from').val();
        var tencty = $('#tencty').val();
        var diachicty = $('#diachicty').val();
        var sdtcty = $('#sdtcty').val();
        var dataString = "action=update&id=4" +
                "&hoten=" + hoten +
                "&mssv=" + mssv +
                "&lop=" + lop +
                "&ngaysinh=" + ngaysinh +
                "&diachi=" + diachi +
                "&sdt=" + sdt +
                "&email=" + email +
                "&loaihs=" + loaihs +
                "&soluong=" + soluong +
                "&ngaynhan=" + ngaynhan +
                "&ghichu=" + ghichu +
                "&tencty=" + tencty +
                "&diachicty=" + diachicty +
                "&sdtcty=" + sdtcty;
        var location = "index.php?com=com_dathang&view=view";
        alert(dataString);
        $.ajax({
            type: "POST",
            url: location,
            data: dataString,
            cache: false,
            beforeSend: function()
            {
                $("#btnsave").html("Đang lưu");
            },
            success: function(response) {

                $("#btnsave").hide().fadeIn('fast').html('Lưu Thông Tin');
                //loadpage(index);
                window.history.go(-1);
                //self.location = location_succ;
            }
        });
    }
    function hienhinhanhhoso() {
        var loaihs = $('#loaihoso').val();
        var dataString = "action=showanh&idhoso=" + loaihs;
        var location = "index.php?com=com_dathang&view=view";
        $.ajax({
            type: "POST",
            url: location,
            data: dataString,
            cache: false,
            beforeSend: function()
            {
            },
            success: function(response) {
            }
        });
    }
</script>
<style>
    .form-group{
        margin-bottom: 0px;
        font-size: 12px;
    }
    .form-control{
        padding: 3px;
        height: 30px
    }
</style> 
<style>
    #calendar,
    #calendar2,
    #calendar3 {
        border: 1px solid #909090;
        font-family: Tahoma;
        font-size: 12px;
    }
    #att_state,
    #att_state2,
    #att_state3 {
        font-family: Tahoma;
        font-size: 12px;
    }
</style>
<script>
    var myCalendar;
    function doOnLoad() {
        myCalendar = new dhtmlXCalendarObject(["date_from", "date_to"]);
        //myCalendar.setDate("2013-03-10");
        myCalendar.hideTime();
        // init values
        var t = new Date();
        byId("date_from").value = (t.getYear() + 1900) + "-" + (t.getMonth() + 1) + "-" + t.getUTCDate();
        byId("date_to").value = (t.getYear() + 1900) + "-" + (t.getMonth() + 1) + "-" + t.getUTCDate();
    }

    function setSens(id, k) {
        // update range
        if (k == "min") {
            myCalendar.setSensitiveRange(byId(id).value, null);
        } else {
            myCalendar.setSensitiveRange(null, byId(id).value);
        }
    }
    function byId(id) {
        return document.getElementById(id);
    }
</script>
<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">ĐẶT HỒ SƠ</h3>
    </div>
    <div class="panel-body">
        <div class="col-md-6">                
            <div class="form-group">
                Họ Tên
                <input type="text" class="form-control" required placeholder="" id="hoten" value="{HO_TEN}">                    
            </div>
            <div class="form-group">
                MSSV/CMND
                <input type="text" class="form-control" required placeholder="" id="mssv" value="{MSSV}">                    
            </div>
            <div class="form-group">
                Lớp
                <input type="text" class="form-control" placeholder="" id="lop" value="{LOP}">                    
            </div>
            <div class="form-group">
                Ngày Sinh
                <input type="text" class="form-control " id="date_from" onclick="setSens('date_to', 'min');" readonly="true" value="{NGAY_SINH}">                    
            </div>

            <div class="form-group">
                Địa chỉ
                <input type="text" class="form-control" placeholder="" id="diachi" value="{DIA_CHI}">                    
            </div>
            <div class="form-group">
                Số điện thoại
                <input type="number" class="form-control" placeholder="" id="sdt" value="{SDT}">                    
            </div>

            <div class="form-group">
                Email
                <input type="email" class="form-control" id="email" value="{EMAIL}">                    
            </div>
            <div class="form-group">
                Loại hồ sơ
                <select class="form-control" id="loaihoso" onchange="hienhinhanhhoso()">
                    <!-- BEGIN:optionhanghoa -->
                    <option value="{OPTION_ID_HANGHOA}">{OPTION_TEN_HANGHOA} - {OPTION_HH_GIATIEN}</option>                        
                    <!-- END:optionhanghoa -->
                </select>               
            </div>
            <div class="form-group">
                Số lượng
                <input type="number" class="form-control" id="soluong" value="{SO_LUONG}">                    
            </div>
            <div class="form-group">
                Ngày Nhận
                <input type="text" class="form-control " value="{NGAY_NHAN}" id="date_to" onclick="setSens('date_from', 'min');" readonly="true">                    
            </div>

        </div>
        <div class="col-md-6">
            <div class="form-group">
                Tên Công Ty
                <input type="text" class="form-control" id="tencty" value="{TEN_CTY}">                    
            </div>
            <div class="form-group">
                Địa chỉ công ty
                <input type="text" class="form-control" id="diachicty" value="{DIA_CHI_CTY}">                    
            </div>
            <div class="form-group">
                Số điện thoại
                <input type="text" class="form-control" id="sdtcty" value="{SDT_CTY}">                    
            </div>

            <div class="form-group">
                <br>
                Hồ sơ gồm có Hồ sơ gồm có hoặc ghi chú thêm
                <script>
                    function eventEnter() {
                        if (event.which == 13) {
                            event.preventDefault();
                            var s = $('#ghichu').val();
                            $('#ghichu').val(s + "<br>\n");
                        }
                    }
                </script>               
                <textarea class="form-control" rows="10" id="ghichu" onkeypress="eventEnter()">{GHI_CHU}</textarea>                 
                <div class="alert-danger">Vui lòng không xóa < br > phía sau của dòng chữ</div>
            </div>
            <div style="clear:both;height: 5px;"></div>
            <div class="form-group">

                <center><button type="button" class="btn btn-primary" id="btnsave" onclick="{ACTION}">Lưu Thông Tin</button></center>              
            </div>

        </div>
        <!-- col md 6-->
        <div class="col-md-5">
            <!-- BEGIN:showanh -->
            <img src="{INDEX}/templates/default/images/{HINH_ANH}" class="col-md-12" width="100%">
            <!-- END:showanh -->
        </div>
    </div>
</div>
<!-- BEGIN:main -->